There is quite a bit you can do with the new ServerManagerCmd.exe command, including the following:
Automatically install or remove roles, role services, and features.
View logs and run queries regarding roles, role services, and features.
Run with an XML file to expedite automated installations that are repetitive through the use of an XML answer file.
To
get started, you need to be a member of the Administrators group on the
server and be running a command prompt with elevated privileges. From
the command prompt, you can type ServerManagerCmd.exe -help
to get started. Note that the response provides syntax and parameter
information. For greater detail on the use of ServerManagerCmd.exe, see
http://technet.microsoft.com/en-us/library/cc748918.aspx. Let’s look at several examples that make it a bit easier to see how this tool may come in handy.
For starters, enter ServerManagerCmd.exe -query to see the various roles and features you have installed as well as roles and features you could install (see Figure 1).
Note
If you want to push the result of the query out to an XML file, you can type ServerManagerCmd.exe -query c:\filename.xml.
For each role, a role identifier must be used. For example, to install the Print Server role, you use Print-Services
as the role identifier. You can install roles by typing the following
(making sure to use the correct syntax, as shown in the results from -query):
ServerManagerCmd -install <role identifier>
Note
If you want the system to reboot after the role is installed, you type -restart at the end of the command.
To remove a role, you type the following:
ServerManagerCmd -remove <role identifier>
Remember that features can be installed just as easily as roles, through the use of the ServerManagerCmd command. For example, to quickly install PowerShell from the command prompt, you type the following:
ServerManagerCmd -i PowerShell
Sometimes
adding or removing a role will cause other items—role services and/or
features—to be added or removed. You might want to see what will be
done by the installation and/or removal of a certain role, and this is where the WhatIf command can be helpful. You can type the following:
ServerManagerCmd -install <Role/Feature Name> -whatif
You now see the possible results before you execute the command. (You can include -logpath c:\filename.txt at the end of this command to port the response to a .txt file.)